import requests,re;


url="https://www.baidu.com/"
headers={
    "user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36"
}   

# 发送请求
res=requests.get(url=url,headers=headers)
res.encoding="utf-8"

# print(res.text)

# 数据解析

# <span class="title-content-title">在青春的赛道上奋力奔跑</span>
titles=re.findall(r'<span class="title-content-title">(.*?)</span>',res.text)
for title in titles:
    print(title)


